Development · Native API migration preview · Coverage validation in progress Published release →

API Browser

Struct

ReadOnlySlice<T>

struct ReadOnlySlice<T>

Module: System
Assembly: System.Runtime.dll
Source file: ReadOnlySlice.rvn

Inheritance: Object → ValueType → ReadOnlySlice<T>

A borrowed readonly view of contiguous managed memory. Readonly is shallow: writes through another alias remain visible. This ref struct cannot be stored.

Properties

2 items
IsEmpty: bool Whether this view has no elements.
Length: int Number of elements in this view.

Indexers

2 items
Item[index: int]: T Reads an element. Invalid indexes fault.
Item[range: Range]: ReadOnlySlice<T> Borrows a half-open range without copying.

Methods

8 items
Equals(other: object?) -> bool Tests reference identity by default; an ordinary class may override equality. Inherited from Object.Equals
GetHashCode() -> int Returns a stable identity hash by default; an ordinary class may override it consistently with equality. Inherited from Object.GetHashCode
GetType() -> TypeInfo Returns metadata for the concrete runtime type of this instance. Inherited from Object.GetType
Slice(range: Range) -> ReadOnlySlice<T> Borrows a half-open range relative to this view.
Slice(start: int, length: int) -> ReadOnlySlice<T> Borrows a nested window. Invalid bounds fault; elements are not copied.
Slice(start: int) -> ReadOnlySlice<T> Borrows from start to the end of this view.
ToArray() -> T[] Copies this view into a newly owned array.
ToString() -> string Returns the concrete runtime type name for supported references, or display text from a class or boxed-struct override. Inherited from Object.ToString

Operators

4 items
Static member: implicit conversion(source: Memory<T>) -> ReadOnlySlice<T> Borrows a persistent writable window for readonly access.
Static member: implicit conversion(source: ReadOnlyMemory<T>) -> ReadOnlySlice<T> Borrows a persistent readonly window without copying.
Static member: implicit conversion(source: Slice<T>) -> ReadOnlySlice<T> Restricts a writable view to readonly access without copying.
Static member: implicit conversion(source: T[]) -> ReadOnlySlice<T> Borrows an array for readonly access; aliases may still write.